package com.doit.day02;

import com.doit.day01.JedisUtil;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;

import java.util.Locale;

public class _02_发布和订阅1 {
    public static void main(String[] args) {
        Jedis jedis = JedisUtil.getJedis();
        jedis.subscribe(new JedisPubSub() {
            @Override
            public void onMessage(String channel, String message) {
                //这边就是你的业务逻辑
                if (channel.equals("a")){
                    System.out.println(message.toUpperCase(Locale.ROOT));
                }else if (channel.equals("b")){
                    System.out.println("b渠道得消息："+message);
                }else {
                    System.out.println("b渠道得消息："+message);
                }

            }
        },"a","b","c");

    }
}
